﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="zeus.Web.Controllers" %>

    <!-- control de acceso para los menus mediante el estado del Rol  -->                        
    <% var working = Session["WorkingSession"] as zeus.Web.Controllers.Helpers.WorkingSession; %>
    <% if (working == null)
       { %>
       <script type="text/javascript">
           document.location.href = "<%= ResolveUrl("~") %>Login";
       </script>
    <% }
       else
       {
    %>
<div id="accordion">    
    
    <%
           var menuNivel1 = working.Menu.Where(p => p.Nivel == 1);
           foreach (var menu in menuNivel1)
           {
    %>
               <h3><a href="#"><%: menu.Nombre %></a></h3>
               <div> 
                <ul>
    <%
               var menuSubnivel = working.Menu.Where(p => p.Padre == menu.Id);
               foreach (var submenu in menuSubnivel)
               {
    %>
                    <li><a href="<%: ResolveUrl("~") + submenu.Url %>"><%: submenu.Nombre%></a></li>         
    <%                   
               }%>    
                </ul>
               </div>       
    <%     } %>          
   
</div>

<% } %>